var obj      = new ActiveXObject('deepcms');
var $$       = this.$$       || obj.getEdk();
var DeepBlog = this.DeepBlog || obj.getDeepBlog();

if(page = Request.QueryString('page')()){
	// POST方法：保存数据
	if(Request.ServerVariables('request_method')() == 'POST'){
		function saveStaticPage(){
			var post     = $$.form.post();
			var filePath = Server.Mappath($$.cfg.edk_root + '/app/form/staticPage.xml');
		    
		    var xml = new ActiveXObject('Msxml2.DOMDocument.6.0');
		    if(!xml.load(filePath)){
		        throw "打开模板文件错误";
		    }
	
			var parentNode = xml.selectSingleNode('//' + page.split('.').pop());
			var CDataNode  = xml.createCDATASection(post['Content']);
			parentNode.replaceChild(CDataNode, parentNode.childNodes(0));
			
			$$.XML.saveXML(xml, filePath);
			
			return true;
		}
		if(saveStaticPage()){
			Response.Write('写入CData数据成功！');
		}
	    Response.End();
	}else{
		// GET方法： 读取模板
		with(eval(page)){
			Response.Write($$.XML.from_XML_CData(xmlFile, xpath, $$.cfg));
		}
	}
}